package com.order.userinterfaces;

import com.order.application.dto.OrderDTO;
import com.order.application.service.OrderService;
import com.order.userinterfaces.vo.OrderVO;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

import static com.order.userinterfaces.converter.OrderDTOConverter.dto2OrderVO;
import static com.order.userinterfaces.converter.OrderDTOConverter.vo2OrderDTO;

/**
 * @Author 刘志伟
 * @create 2022/9/26 14:22
 */
@RestController
@RequestMapping("/api/v1/users")
public class UserController {
    @Resource(name = "orderService")
    private OrderService orderService;

    @GetMapping("")
    public OrderVO getUserInfo(@RequestParam String id) {

        OrderDTO orderDTO = orderService.getOrderById(id);
        return dto2OrderVO(orderDTO);
    }
}
